package cn.mulanbay.job.web;

import cn.mulanbay.business.listener.StartListener;
import cn.mulanbay.business.listener.StopListener;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableFeignClients(basePackages="cn.mulanbay.api.system")
@SpringBootApplication(scanBasePackages = "cn.mulanbay.job")
@EnableTransactionManagement
@MapperScan({"cn.mulanbay.persistent.mapper","cn.mulanbay.schedule.mapper"})
@EnableConfigurationProperties(DataSourceProperties.class)
public class MulanbayJobApplication {

    private static final Logger logger = LoggerFactory.getLogger(MulanbayJobApplication.class);

    public static void main(String[] args) {
        SpringApplication sa = new SpringApplication(MulanbayJobApplication.class);
        sa.addListeners(new StartListener());
        sa.addListeners(new StopListener());
        sa.run(args);
        logger.info("调度模块启动成功");
    }
}
